package com.cbb.display.config.quartz;

import java.io.IOException;
import java.util.Properties;

import org.quartz.Scheduler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;

/** 

* @author 作者 lujunjie: 

* @version 创建时间：Jan 18, 2020 11:25:51 AM 

* 类说明 

*/
@Configuration
public class QuartzConfigration {
 
  @Autowired
  JobFactory jobFactory;
 
  @Bean
  public SchedulerFactoryBean schedulerFactoryBean() throws IOException {
    SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
    schedulerFactoryBean.setOverwriteExistingJobs(true);
    schedulerFactoryBean.setJobFactory(jobFactory);
    return schedulerFactoryBean;
  }
 
 
  // 创建schedule
  @Bean(name = "scheduler")
  public Scheduler scheduler() throws IOException {
    return schedulerFactoryBean().getScheduler();
  }
}
